<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>vue</title>
    <script src='https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js'></script>
</head>

<body>
    <div id='app'>
        <navbar>
            <button @click="click">click</button>
        </navbar>
        <sidebar v-show="isShow"></sidebar>
    </div>
</body>
<script>
    Vue.component('navbar', {
        template: `
        <div style="background:yellow">
           navbar--<slot></slot>    
        </div>
        `,
    });

    Vue.component('sidebar', {
        template: `
        <ul style="background-color:yellowgreen;width:200px;height:200px">
            <li>首页</li>    
            <li>钱包</li>    
            <li>设置</li>    
        </ul>
        `,
    })
    let vm = new Vue({
        el: '#app',
        data: {
            isShow: true
        },
        methods: {
            click() {
                this.isShow = !this.isShow
            }
        }
    });
</script>

</html>